const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async(event, context) => {

  var m_scene = event.scene;
  var m_page = event.page;
  var m_width = event.width;
  try {
    const result = await cloud.openapi.wxacode.getUnlimited({
      scene: m_scene, //物业小区代码
      page: m_page,
      width: m_width
    })
    return {
      buffer: await cloud.uploadFile({
        cloudPath: 'qrcode.jpg',
        fileContent: result.buffer,
      }),
      parameter: 'wwwwwwwww'
    }
  } catch (err) {
    console.log(err)
    return err
  }
}